package com.jinzheng.model;

import com.jinzheng.constants.PetConstant;

/**
 * @author Administrator
 * @date 2020/12/30 9:09
 * @description
 **/
public class Pet {
    private String name;        //宠物的名称
    private String strain;      //宠物的品种
    private Integer living;     //宠物的生命值

    public Pet() {
    }

    public Pet(Integer living) {
        this.living = living;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStrain() {
        return strain;
    }

    public void setStrain(String strain) {
        this.strain = strain;
    }

    public Integer getLiving() {
        return living;
    }

    public void setLiving(Integer living) {
        if (living >= PetConstant.PET_LIVING){
            living = PetConstant.PET_LIVING;
        }
        this.living = living;
    }

    @Override
    public String toString() {
        return "Pet{" +
                "name='" + name + '\'' +
                ", strain='" + strain + '\'' +
                ", living=" + living +
                '}';
    }

    public void say(){
        System.out.println("我叫"+getName()+"，品种是"+getStrain()+"，健康值是"+getLiving());
    }
}
